package gggameserver.games.connection;

import gggameserver.exceptions.GGTimeout;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class CommandLine implements GGConnection {

	private String name;
	BufferedReader in;

	public CommandLine(String name) {
		this.name = name;
		this.in = new BufferedReader(new InputStreamReader(System.in));
	}

	public void sendCommand(String cmd) {
		System.out.println(name + "<" + cmd);
	}

	public String receiveCommand(long timeout) throws GGTimeout {
		System.out.print(name + ">");
		String a = null;
		try {
			a = in.readLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return a;
	}

	public void close() {
		// TODO Auto-generated method stub

	}

}
